package linguo.input;

import java.awt.event.KeyEvent;

import linguo.Game;
import linguo.GameState;

 /**
  * Clase encargada de la entrada por teclado al juego.
  *@author Corpaz German
  *@author Frank Andres
  *
  */
public class KeyboardHandler {

	private Game game;

	public KeyboardHandler(Game game) {
		this.game = game;
	}

	public void keyPressed(KeyEvent e) {
	}
		

	public void keyReleased(KeyEvent e) {
		if (game.getState() != GameState.INGAME) return;
		
		int key = e.getKeyCode();
		switch (key) {
			case (KeyEvent.VK_UP) : game.getRobot().avanzar(); break;
			case (KeyEvent.VK_LEFT) : game.getRobot().girarIzquierda(); break;
			case (KeyEvent.VK_RIGHT) : game.getRobot().girarDerecha(); break;
			case (KeyEvent.VK_SPACE) : game.getRobot().tryToFire(); break;
			
			case (KeyEvent.VK_SHIFT) : game.getRobot().usarBrazo(); break;
			case (KeyEvent.VK_CONTROL) : game.getRobot().dropColeccionable(); break;
			
			case (KeyEvent.VK_ENTER) : game.getRobot().togglePincel(); break;
			case (KeyEvent.VK_1) : game.getRobot().toggleColorPincel(1); break;
			case (KeyEvent.VK_0) : game.getRobot().toggleColorPincel(0); break;
			
			case (KeyEvent.VK_G) : game.toogleGrid(); break;
			case (KeyEvent.VK_F) : game.toogleFPS(); break;
		}
	}
	

}
